package reflect;

import java.util.Arrays;

/**
 * JDK1.5之后，java推出了一个特性:变长参数
 */
public class ArgsDemo {
    public static void main(String[] args) {
           doSome(1);
           doSome(1,"a");
           doSome(1,"a","b");
           doSome(1,"a","b","c","b","c","b","c","b","c","b","c","b","c","b","c");
    }
    /*
        变长参数只能方法的最后一个参数
        这意味着，一个方法不能有两个变长参数，且变长参数后面不能再定义其他参数
     */
    public static void doSome(int a,String... args){
        System.out.println(args.length);
        System.out.println(Arrays.toString(args));
    }
}
